import React,{Component} from 'react'
import {Button,Modal} from "antd";
import './WtBooks.css'

class WtBookDetailsModal extends Component {
    constructor(props) {
        super(props)
        this.state = {
            detailVisible: false,
        }

    }
    visibleBookDetails = (value) => {
        let state= value.isNum>0 ? '在馆':'借空';
        return(
            <div>
                <span>ISBN号：<span className="bookDetailValue">{value.isbn}</span></span>
                <span>图书类型：<span className="bookDetailValue">{value.bookType}</span></span><br/>
                <span>出版社：<span className="bookDetailValue">{value.publisher}</span></span>
                <span>图书名称：<span className="bookDetailValue">{value.bookName}</span></span><br/>
                <span>总数量：<span className="bookDetailValue">{value.totalNum}</span></span>
                <span>作者名称：<span className="bookDetailValue">{value.authorName}</span></span><br/>
                <span>&emsp;日期：<span className="bookDetailValue">{value.date}</span></span>
                <span>在馆数量：<span className="bookDetailValue">{value.isNum}</span></span><br/>
                <span>&emsp;价格：<span className="bookDetailValue">{value.price}</span></span>
                <span>在馆状态：<span className="bookDetailValue">{state}</span></span><br/>
            </div>
        )
    }


    handleBookDetailOk = ()=> {
        this.props.handleBookDetailOk(false)
    };
    render() {

        const {value} = this.props;
        return (
            <div>
                <Modal
                    title="详细信息"
                    visible={this.props.detailVisible}
                    onOk={this.handleBookDetailOk}
                    onCancel={this.handleBookDetailOk}
                    footer={<div><Button type="primary" onClick={()=>{this.handleBookDetailOk()}}>确认</Button></div>}
                >
                <p>{value && this.visibleBookDetails(value)}</p>
                </Modal>
            </div>
        );
    }
}
export default WtBookDetailsModal